<template>
	<view class="news-detail__page">
		<view class="title__item">{{newsInfo.title}}</view>
		<view class="date__item">{{newsInfo.created_at}}</view>
		<image  v-if="newsInfo.image" :src="setting.host+'/image/show/'+newsInfo.image" mode="aspectFill" class="image__item"></image>
		<view class="content__item">{{newsInfo.content}}</view>
	</view>
</template>

<script>
	import setting from '../../setting.js';
	
	export default {
		data() {
			return {
				id: 0,
				newsInfo: {},
				setting,
			};
		},
		onLoad(option) {
			this.id = option.id || 6;
			this.main()
		},
		methods: {
			async main() {
				await this.getNewsDeatil()
			},
			async getNewsDeatil() {
				const [err, result] = await this.$https({
					url: '/wechat/getnewsbyid',
					method: 'POST',
					data: {
						id: this.id
					}
				})
				this.newsInfo = result.data.data[0];
			}
		}
	}
</script>

<style lang="scss">
.news-detail__page{
	padding: 20px;
	box-sizing: border-box;
	.title__item {
		font-size: 24px;
		font-weight: bold;
	}
	.date__item {
		margin: 20px 0;
		font-size: 12px;
		color: #aaa;
	}
	.image__item{
		width: 100%;
	}
	.content__item{
		margin-top: 20px;
		font-size: 16px;
		text-indent: 32px;
		line-height: 2;
		text-align: justify;
	}
}
</style>
